package archer.framework.file.repository;


import archer.framework.file.entity.FileResource;
import archer.framework.file.entity.Metadata;

/**
 * 文件仓库
 *
 * @author christ
 * @date 2015/9/24
 */
public interface Repository {


    /**
     * 添加公有文件资源
     *
     * @param file
     * @return
     * @throws RepositoryStorageException
     */
    Metadata addPublicFileResource(FileResource file, String subDir) throws RepositoryStorageException;

    /**
     * 添加私有文件资源
     *
     * @param file
     * @return
     * @throws RepositoryStorageException
     */
    Metadata addPrivateFileResource(FileResource file, String subDir) throws RepositoryStorageException;

    /**
     * 获得文件资源
     *
     * @param id
     * @return
     * @throws RepositoryStorageException
     */
    FileResource getFileResource(String subDir, String id) throws RepositoryStorageException;

    /**
     * 获得元数据
     *
     * @param id
     * @return
     * @throws RepositoryStorageException
     */
    Metadata getMetadata(String subDir, String id) throws RepositoryStorageException;

    /**
     * 删除文件
     *
     * @param id
     * @throws RepositoryStorageException
     */
    void deleteFileResource(String subDir, String id) throws RepositoryStorageException;

}
